import Router from 'vue-router'
import Vue from 'vue';

Vue.use(Router)


const ProductList = () => import('@/pages/ProductList.vue');
// const ProductDetail = () => import('@/pages/ProductDetail.vue');
const Privacy = () => import('@/pages/PrivacyAgreement.vue');
// const ArticleDetail = () => import('@/pages/ArticleDetail.vue');
const ActivityDetail = () => import('@/pages/ActivityDetail.vue');
const TopicDetail = () => import('@/pages/TopicDetail.vue');
const VideoDetail = () => import('@/pages/VideoDetail.vue');
const ArticleDetail = () => import('@/pages/ArticleDetail.vue');
const PreviewArticleDetail = () => import('@/pages/preview/ArticleDetail.vue');
const Download = () => import('@/pages/Download.vue');
// const ActivityDetail2 = () => import('@/pages/preview/ActivityDetail.vue');
// const VideoDetail = () => import('@/pages/preview/VideoDetail.vue');
// const TopicDetail = () => import('@/pages/preview/TopicDetail.vue');

export default new Router({
  mode: 'history',
  base:"/shop/",
  routes: [
    {
      path: '/',
      redirect: '/products'
    },
    {
      path: '/products',
      name: 'ProductList',
      component: ProductList,
      meta: { requiresAuth: false }
    },
    {
      path: '/privacy',
      name: 'Privacy',
      component: Privacy,
      meta: { requiresAuth: false }
    },
    {
      path: '/download',
      name: 'Download',
      component: Download,
      meta: { requiresAuth: false }
    },
    {
      path: '/preview/article',
      name: 'previewArticle',
      component: PreviewArticleDetail,
      meta: { requiresAuth: false }
    },
    {
      path: '/article/:id',
      name: 'ArticleDetail',
      component: ArticleDetail,
      meta: { requiresAuth: false }
    },
    {
      path: '/activity/:id',
      name: 'ActivityDetail',
      component: ActivityDetail,
      meta: { requiresAuth: false }
    },
    {
      path: '/topic/:id',
      name: 'TopicDetail',
      component: TopicDetail,
      meta: { requiresAuth: false }
    },
    {
      path: '/video/:id',
      name: 'VideoDetail',
      component: VideoDetail,
      meta: { requiresAuth: false }
    }
  ],
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  }
});